package com.ywk.skywalkingApi.business.service;


import com.ywk.skywalkingApi.business.entity.Student;
import com.ywk.skywalkingApi.business.mapper.StudentMapper;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *
 * http://wed.xjx100.cn/news/63635.html?action=onClick
 * @Author zbh
 * @Date 2023/6/28
 */
@Service
public class StudentService {

    @Autowired
    StudentMapper mapper;

    public Integer getCount(){
        Integer count = mapper.getCount();
        return count;
    }

    @Trace
    @Tag(key = "list", value = "returnedObj")//list：自定义名称，returnedObj：返回值
    public List<Student> findAll(){
        List<Student> students = mapper.findAll();
        return students;
    }

    @Trace
    @Tags({@Tag(key = "param", value = "arg[0]"),@Tag(key = "student", value = "returnedObj")})//param：自定义名称，arg[0]：入参，user:自定义名称，returnedObj：返回值
    public Student findById(Integer id){
        Student student = mapper.findById(id);
        return student;
    }

}
